﻿{% extends 'cms/base.html' %}
{% block title %}
面板
{% endblock %}

{% block head %}
{% endblock %}

{% block page_header %}
面板
{% endblock %}

{% block content %}

<div class="row">
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                查询选修“3”课程的成绩高于“5”号同学成绩的所有同学的记录
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                     <th>学号</th>
                    <th>姓名</th>
                    <th>成绩</th>
                </tr>

                    {% for result in sql14 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                            <td>{{ result[1] }}</td>
                            <td>{{ result[2] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>

        </div>
    </div>
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                能查询3号的课程且成绩至少高于4号课程的同学的学号、课程号以及成绩，并按成绩从高到低次序排序
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                    <th>学号</th>
                    <th>课程号</th>
                    <th>成绩</th>
                </tr>

                    {% for result in sql20 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                            <td>{{ result[1] }}</td>
                            <td>{{ result[2] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>

    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
               查询和学号为1的同学同年出生的所有学生的Sno、Sname和Sbirthday列
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                     <th>学号</th>
                    <th>姓名</th>
                    <th>生日</th>
                </tr>

                    {% for result in sql15 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                            <td>{{ result[1] }}</td>
                            <td>{{ result[2] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                能查询至少有5名学生选修的并以'计'开头的课程的平均分数
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                    <th>平均分</th>
                </tr>

                    {% for result in sql11 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>

        </div>
    </div>
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                能查询存在有某个分数（比如85分）以上成绩的课程号.
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                    <th>课程号</th>
                </tr>

                    {% for result in sql18 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>

        </div>
    </div>

    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                查询学生最大和最小的出生日期值
            </div>
            <div class="panel-body">
               <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                   <tr>
                       <th>最小生日</th>
                        <th>最大生日</th>
                   </tr>

                        <tr>
                            <td>{{ sql26[0][0] }}</td>
                            <td>{{ sql26[0][1] }}</td>
                        </tr>
                </table>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                 能查询成绩比该课程平均成绩低的同学的成绩表
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                     <th>学号</th>
                    <th>课程号</th>
                    <th>成绩</th>
                </tr>

                    {% for result in sql22 %}
                        <tr>
                            <td>{{ result[0] }}</td>
                            <td>{{ result[1] }}</td>
                            <td>{{ result[2] }}</td>
                        </tr>
                    {% endfor %}

                </table>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
    <div class="col-md-4 col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                 查询和“张三”同性别并同班的同学姓名。
            </div>
            <div class="panel-body">
                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                <tr>
                     <th>姓名</th>
                </tr>

                    {% for result in sql28 %}
                        <tr>
                            <td>{{ result[0] }}</td>

                        </tr>
                    {% endfor %}

                </table>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
</div>

<div class="row">
    <form action="" method="post">
        <table border="0px" cellspacing="" cellpadding="" class="table">
        <tr>
            <td>
                请输入查询sql语句
            </td>
            <td>
                <input type="text" name="inputSql" class="form-control">
            </td>
            <td>
                <input type="submit" value="提交">
            </td>
        </tr>
            {% if results !='' and inputTypeFlag %}
                {% for result in results %}
                    <tr>
                    {% for item in result %}
                        <td>{{ item }}</td>
                    {% endfor %}
                    </tr>

                {% endfor %}

            {% endif %}
    </table>
    </form>

</div>
{% endblock %}